From bd9cf885a23c35aa4d89ed9e22f020bca4feb16e Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 14 Apr 2016 10:40:36 -0700 Subject: [PATCH] Remove submodule directory before cloning If the directory is in a corrupt state that caused an existing repository to not successfully open, then we'll want to blow it away anything that already exists to ensure we start from a clean slate. Closes #2567 --- src/cargo/sources/git/utils.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/cargo/sources/git/utils.rs b/src/cargo/sources/git/utils.rs index d865262d0..74ae03398 100644 --- a/src/cargo/sources/git/utils.rs +++ b/src/cargo/sources/git/utils.rs @@ -339,6 +339,7 @@ impl<'a> GitCheckout<'a> { } Err(..) => { let path = repo.workdir().unwrap().join(child.path()); + let _ = fs::remove_dir_all(&path); try!(git2::Repository::clone(url, &path)) } }; -- 2.30.2